<?php get_header() ?>

<div class="content-header"></div>

<div id="content">
	<?php do_action( 'template_notices' ) ?>

	<div id="dpa">
		<div id="dpa-graphs">
		<?php
		global $bp;

		if ( bp_is_home() )
			$user_id = $bp->loggedin_user->id;
		else
			$user_id = $bp->displayed_user->id;

		dpa_draw_overallcompletiondetails( $user_id );
		dpa_draw_categorycompletiondetails( $user_id );
		?>
		</div>

		<?php
		$recent_achievements = (array) dpa_get_last_five_unlocked_achievements( $user_id );
		if ( count( $recent_achievements ) > 0 ) {

			echo '<h2>' . __( 'Recent Achievements', 'dp-achievements' ) . '</h2>';
			foreach ( $recent_achievements as $a ) { ?>
				<p><?php echo sprintf( '<span class="dpa-title">%s</span> - %s', apply_filters( 'dpa_filter_achievement_nice_name', __( $a['nice_name'], 'dp-achievements' ) ), apply_filters( 'dpa_filter_achievement_description', __( $a['description'], 'dp-achievements' ) ) ); ?>
				<?php echo sprintf( '<span class="dpa-timestamp">%s</span></p>', apply_filters( 'dpa_filter_achievement_date', mysql2date( get_option( 'date_format' ), $a['achieved_at'] ) ) ); ?>
			<?php } ?>

		<?php } ?>
	</div>
</div>

<?php get_footer() ?>